/*
 * netops.h
 *
 *  Created on: Dec 15, 2010
 */

#ifndef NETOPS_H_
#define NETOPS_H_


// for sockaddr_in.
#include <arpa/inet.h>

int CreateTcpMessage(int nPort);
int CreateUdpMessage(int nPort);
int CloseSocket(int nSockDescriptor);
int DestroyUdpMessage(int nSockDescriptor);
int FillInSockAddrStructure(struct sockaddr_in* pstSockAddr, const char *szAddress, int nPort);
int OpenTcpMessage(int nPort, const char *szAddress);
int OpenUdpMessage(const char *szAddress, int nPort, struct sockaddr_in* pstReturnSockAddr);
ssize_t ReceiveUdpMessage(int nSockDescriptor, char *szMessage, int nMaxMessageLength, int nRecoverOnIntr);
int ReleaseIpMessage(int nSockDescriptor);
ssize_t SendUdpMessage(struct sockaddr_in *pstSockAddr, int nSockDescriptor, const char *szMessage, size_t nMsgLength);
#endif /* NETOPS_H_ */
